package clientRequest;

import java.io.Serializable;

/**
 * class ClientRequest this class contains all the details of the client request
 * in order to pass this to the server
 */
public class ClientRequest implements Serializable {
 
	 private String userID; //the user id
	 private String kindRequest; //the kind of the request-modify/create/delete
	 private String filePath; //the path of the file that was changed
	 private String fileName; //the name of the file that was changed
	 private byte[] byteFile; //the file that was changes in bytes
	 private long checksum; //the checksum (a hash) of the file that was changed
	 private boolean isFolder; //a flag if the change occurred on a folder or a file
	 private boolean isMyDropBox;//a flag if the change occurred in the dropbox folder
	 private boolean isWebUpload; //a flag if the change came from the web (true) or from the service (false)
	 
	 /**
	  * 
	  * @param userID the user id
	  * @param kindRequest the kind of the request-modify/create/delete
	  * @param fileName the name of the file that was changed
	  * @param filePath the path of the file that was changed
	  * @param byteFile the file that was changes in bytes
	  * @param checksum the checksum (a hash) of the file that was changed
	  * @param isFolder a flag if the change occurred on a folder or a file
	  * @param isMyDropBox a flag if the change occurred in the dropbox folder
	  */
	 public ClientRequest(String userID,String kindRequest,String fileName,String filePath,byte[] byteFile, long checksum ,boolean isFolder,boolean isMyDropBox) {
		
		this.userID=userID;
		this.kindRequest=kindRequest;
		this.fileName=fileName;
		this.filePath=filePath;
		this.byteFile=byteFile;
		this.checksum=checksum;
		this.isFolder=isFolder;
		this.isMyDropBox=isMyDropBox;
		this.isWebUpload = false;
		// TODO Auto-generated constructor stub
	}
	 
	 /**
	  * ctor
	  * @param userID the user id
	  * @param kindRequest the kind of the request-modify/create/delete
	  * @param fileName the name of the file that was changed
	  * @param filePath the path of the file that was changed
	  * @param byteFile the file that was changes in bytes
	  * @param checksum the checksum (a hash) of the file that was changed
	  * @param isFolder a flag if the change occurred on a folder or a file
	  * @param isMyDropBox a flag if the change occurred in the dropbox folder
	  * @param isWebUpload a flag if the change came from the web (true) or from the service (false)
	  */
	 public ClientRequest(String userID,String kindRequest,String fileName,String filePath,byte[] byteFile, long checksum ,boolean isFolder,boolean isMyDropBox, boolean isWebUpload) {
		this.userID=userID;
		this.kindRequest=kindRequest;
		this.fileName=fileName;
		this.filePath=filePath;
		this.byteFile=byteFile;
		this.checksum=checksum;
		this.isFolder=isFolder;
		this.isMyDropBox=isMyDropBox;
		this.isWebUpload = isWebUpload;
		// TODO Auto-generated constructor stub
	}
	
	 /**
	  * ctor
	  * @param userID the user id
	  * @param kindRequest the kind of the request-modify/create/delete
	  */
	 public ClientRequest(String userID,String kindRequest) {
	  
	  this.userID=userID;
	  this.kindRequest=kindRequest;
	  
	 }
	
	/**
	 * This method prints the client request
	 */
	 public void printRequest() {
	  
	  System.out.println("request:  "+kindRequest+filePath+fileName+" "+checksum);
	  // TODO Auto-generated method stub
	  
	 }
	 
	 /**
	  * 
	  * @return the kind of the request-modify/create/delete
	  */
	 public String getKindRequest() {
	  return kindRequest;
	 }
	
	 /**
	  * 
	  * @return the path of the file that was changed
	  */
	 public String getFilePath() {
	  return filePath;
	 }
	
	 /**
	  * 
	  * @return the name of the file that was changed
	  */
	 public String getFileName() {
	  return fileName;
	 }
	
	 /**
	  * 
	  * @return the file that was changed in bytes
	  */
	 public byte[] getByteFile() {
	  return byteFile;
	 }
	
	 /**
	  * 
	  * @return the user's id
	  */
	 public String getUserID() {
	  return userID;
	 }
	
	 /**
	  * 
	  * @return the checksum of the file that was changed
	  */
	 public long getChecksum() {
	  return checksum;
	 }
	
	 /**
	  * 
	  * @return a flag if the change occurred on a folder or a file
	  */
	 public boolean isFolder() {
	  return isFolder;
	 }
	
	/**
	 * 
	 * @return a flag if the change occurred in the dropbox folder
	 */
	 public boolean isMyDropBox() {
	  return isMyDropBox;
	 }


	 /**
	  * @return a flag if the change came from the web (true) or from the service (false)
	  */
	 public boolean isWebUpload() {
		 return isWebUpload;
	 }

}